<template>
  <div class="loading-screen">
    <div class="loading-box">
      <div class="loading">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
      </div>
      <div class="loading-text">加载中</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Loading",
};
</script>

<style lang="scss" scoped>
$size: 16px;
.loading-screen {
  position: relative;
  width: 100%;
  height: 100%;
  // background: rgba(0, 0, 0, 0.531);

  .loading-box {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    padding: 6px;
    transform: translateX(-50%) translateY(-50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    // background: #fff;
    // border-radius: 4px;
    // border: 1px solid var(--main-border);
    // box-shadow: 0 2px 12px 0 var(--main-shadow);
    overflow: hidden;
    z-index: 1024;
  }

  .loading-text {
    width: 100%;
    color: var(--title-color);
    font-size: 12px;
    padding: 6px 0 0 0;
    text-align: center;
  }

  @keyframes rotate {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }

  @keyframes scale {
    50% {
      transform: scale(1.2);
    }
  }

  .loading {
    width: 46px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    animation: rotate 2s linear infinite;

    & span {
      display: block;
      width: $size;
      height: $size;
      background: red;
      margin: 1px;
      // animation: scale 1.5s linear infinite;
    }

    & span:nth-child(1) {
      border-radius: 50% 70% 0% 70%;
      background: #70e767;
      transform-origin: bottom right;
      animation-delay: 0.5s;
    }

    & span:nth-child(2) {
      border-radius: 70% 50% 70% 0%;
      background: #6778e7;
      transform-origin: bottom left;
      animation-delay: 1s;
    }

    & span:nth-child(3) {
      border-radius: 70% 0% 70% 50%;
      background: #e4925b;
      transform-origin: top right;
      animation-delay: 1.5s;
    }

    & span:nth-child(4) {
      border-radius: 0% 50% 50% 70%;
      background: #6fe5cc;
      transform-origin: top left;
      animation-delay: 1s;
    }
  }
}
</style>